home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / tablePlug / rx / arteffect.tpx < prev    next >
Text File  |  1999-09-25  |  994b  |  59 lines

  1. /*
  2.  
  3.     arteffect.tpx v1.1 © 1999 Esteve Boix
  4.  
  5.     Uses ArtEffect to load the images and scale them down.
  6.     This tpx uses the ArtEffect internal loaders.
  7.  
  8.     Tested with ArtEffect3, should work on v2 (and v1 ???).
  9.  
  10.     Args: SIZEX SIZEY JPEG_COMPRESSION
  11.  
  12.     Where:
  13.  
  14.         SIZEX, SIZEY        Size in pixels of the thumbnail
  15.         JPEG_COMPRESSION    Well...
  16.  
  17. */
  18.  
  19. options results
  20.  
  21. parse arg maxsizex maxsizey compression infile outfile
  22.  
  23. infile=strip(infile)
  24. outfile=strip(outfile)
  25.  
  26. address 'ArtEffect'
  27. LoadPic '"'infile'"'
  28.  
  29. /* Obtain info about the image */
  30. get stem size. pictureinfo
  31.  
  32. x = size.width
  33. y = size.height
  34.  
  35. /* ...and calculate the thumbnail resolution */
  36.  
  37. comp=trunc((maxsizex/x)*y)
  38.  
  39. if comp<=maxsizey then do
  40.  
  41.  
  42.     scalepic maxsizex comp
  43.     end
  44.  
  45. else do
  46.                                     /* No */
  47.  
  48.     comp2=trunc((maxsizey/y)*x)
  49.  
  50.     scalepic comp2 maxsizey
  51.  
  52. end
  53.  
  54. /* And save the image */
  55.  
  56. SavePic '"'outfile'"' plugin 'JFIF-JPEG' quality '"'||compression||'"'
  57. ClosePic
  58.  
  59.